<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>天地图加载GeoServer WMS</title>
    <script src="/Public/js/tianditu.api.js"></script>
    <link rel="icon" href="/Public/imgs/H.ico">
    <style>
        html,
        body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        #map {
            position: relative;
            width: 100%;
            height: 100%;
        }
    </style>
</head>

<body>
    <div id="map"></div>
    <button id="btn1">T</button>
    <div id="treeCon1">
        <button id="btn2">X</button>
    </div>
    <script>
        var map = new T.Map('map', { tileSize: 512 });
        map.centerAndZoom(new T.LngLat(103, 30), 14);

        const OriginalLabel = T.Label;

        // 创建新的 Label 构造函数
        T.Label = function (options) {
            console.log('🚀 T.Label 构造函数被调用', options);

            // 调用父类构造函数
            const instance = new OriginalLabel(options);

            console.log('a - Label 实例创建完成');

            // 返回实例
            return instance;
        };

        const ml = new T.Label({
            text: 'tttt',
            position: new T.LngLat(103, 30)
        })
        map.addOverLay(ml);

    </script>
</body>

</html>